"""ttsx URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/2.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""

from django.views import static  ##新增
from django.conf.urls.static import static
from django.conf.urls import url, include
from django.conf import settings  ##新增
from django.conf.urls import url  ##新增
from django.contrib import admin
from django.urls import path
from goods.views import index, shop, shopDetails, search
from cart.views import cart

urlpatterns = [
    path('admin/', admin.site.urls),  # 后台管理
    path('index/', index, name="index"),  # 首页路由
    path('', index),  # 默认显示首页
    path('shop/<int:cag_id>/<int:current_page>', shop, name="shop"),  # 不同类别商品分类展示
    path('shopDetails/<int:id>/<int:cag_id>', shopDetails, name="shopDetails"),  # 具体的商品信息
    path('search/<int:current_page>/<str:q>', search, name='search'),   # 搜索展示
    path('cart/', include('cart.urls')),  # 购物车
 ]+static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
